<!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
<stack>
<name>in</name>
<id>-1</id>
<cardCount>2</cardCount>
<cardID>3233</cardID>
<listID>3468</listID>
<cantModify><false /></cantModify>
<cantDelete><false /></cantDelete>
<cantAbort><false /></cantAbort>
<cardSize>
<width>512</width>
<height>342</height>
</cardSize>
<script>on domenu menu --// Added by Medior, Inc. 2/20/90global RPStackNameif menu is in "Home,Quit HyperCard" and RPStackName is not empty thenset cursor to watchput RPStackName into shortnamerepeat until offset(":",shortname) = 0delete char 1 to offset(":",shortname) of shortnameend repeatdelete last char of shortnameanswer "This will return to "&shortname&"." with "Cancel" or "OK"if it is "Cancel" then exit domenuset cursor to watchlock screengo RPStackNameunlock screen with dissolveexit domenuelse pass doMenuend domenuon openStackdefineStructset the lineSize to 1set the pattern to 1show message at 22,300end openStackon closeStackput empty into messageset the pattern to 12end closeStackon openCardglobal rootNode, searchPath, pathLengthif the number of card fields > 0 thenput the id of card field 1 into rootNodeelseput 0 into rootNodeend ifput empty into searchPathput 0 into pathLengthwalkTreeend openCardon deleteCardglobal searchPath, pathLengthput empty into searchPathput 0 into pathLengthend deleteCardon closeCardundoPlotput empty into field treeListend closeCardon defineStructglobal rootRect, rootLoc, hSpacing, vSpacing, rootLevelput "241,148,271,163" into rootRectput "256,155" into rootLocput "16,32,64,128" into hSpacingput "30,30,30,30" into vSpacingput 4 into rootLevelend defineStructon eraseTreeglobal rootNode, seachPath, pathLengthchoose select tooldrag from 0,0 to 512,342doMenu "Clear Picture"choose field toolrepeat with i = the number of card fields down to 1click at the loc of card field idoMenu "Clear Field"end repeatput 0 into rootNodeput empty into searchPathput 0 into pathLengthchoose browse toolend eraseTreeon initPlot targetNodeglobal searchPath, pathLengthundoPlotput targetNode into line 1 of searchPathput the loc of card field id targetNode into¬line 2 of searchPathput 2 into pathLengthset the style of card field id targetNode to shadowset the lineSize to 2choose line toolend initPloton termPlotset the lineSize to 1choose browse toolend termPloton pathPlot targetNodeglobal searchPath, pathLengthif targetNode ≠ 0 thenadd 1 to pathLengthput targetNode into line pathLength of searchPathadd 1 to pathLengthput the loc of card field id targetNode into¬line pathLength of searchPathset the style of card field id targetNode to shadowdrag from line pathLength - 2 of searchPath to¬line pathLength of searchPathend ifend pathPloton undoPlotglobal searchPath, pathLengthif pathLength > 0 thenchoose line toolput line 1 of searchPath into targetNodeset the style of card field id targetNode to rectangleput line 2 of searchPath into parentLocput 3 into pathIndexrepeat while pathIndex < pathLengthput line pathIndex of searchPath into targetNodeadd 1 to pathIndexget line pathIndex of searchPathadd 1 to pathIndexset the style of card field id targetNode to rectangleset the lineSize to 2drag from parentLoc to it with optionKeyset the lineSize to 1drag from parentLoc to itput it into parentLocend repeatput empty into searchPathput 0 into pathLengthchoose browse toolend ifend undoPlotfunction searchTree keyglobal rootNode, rootLevelglobal parentSide, parentNode, parentLevel, targetNodeput 0 into parentSideput 0 into parentNodeput rootLevel + 1 into parentLevelif rootNode = 0 thenput 0 into targetNodereturn "missing"elseinitPlot rootNodeif key = line 1 of card field id rootNode thenput rootNode into targetNodereturn "found"end ifend ifput rootNode into parentNodeput rootLevel into parentLevelput 0 into targetNoderepeat while trueget line 1 of card field id parentNodeif key < it thenput 2 into parentSideget line 2 of card field id parentNodeif it ≠ 0 thenpathPlot itif key = line 1 of card field id it thenput it into targetNodereturn "found"elseput it into parentNodesubtract 1 from parentLevelend ifelsereturn "missing"end ifelseif key > it thenput 3 into parentSideget line 3 of card field id parentNodeif it ≠ 0 thenpathPlot itif key = line 1 of card field id it thenput it into targetNodereturn "found"elseput it into parentNodesubtract 1 from parentLevelend ifelsereturn "missing"end ifend ifend ifend repeatend searchTreefunction newNode nodeLocglobal rootRectchoose field tooldoMenu "New Field"get the number of card fieldsget the id of card field itset the rect of card field id it to rootRectset the loc of card field id it to nodeLocset the style of card field id it to rectangleset the textFont of card field id it to genevaset the textSize of card field id it to 9set the textAlign of card field id it to centerset the lockText of card field id it to trueput 0 into line 2 of card field id itput 0 into line 3 of card field id itreturn itend newNodefunction getNodeLoc parentSide, parentNode, parentLevelglobal rootLoc, hSpacing, vSpacingif parentNode = 0 thenreturn rootLocelseput the loc of card field id parentNode into nodeLocget item parentLevel of vSpacingadd it to item 2 of nodeLocget item parentLevel of hSpacingif parentSide = 2 thensubtract it from item 1 of nodeLocelseadd it to item 1 of nodeLocend ifreturn nodeLocend ifend getNodeLocfunction makeNode parentSide, parentNode, parentLevelglobal rootLocif parentNode = 0 thenget newNode( rootLoc )initPlot itreturn itelseput getNodeLoc( parentSide, parentNode, parentLevel ) into nodeLocget newNode( nodeLoc )put it into line parentSide of card field id parentNodechoose line toolpathPlot itreturn itend ifend makeNodefunction insertNode keyglobal rootNode, parentSide, parentNode, parentLevelget searchTree( key )if it = "found" thentermPlotreturn "duplicate"end ifif parentLevel = 0 thentermPlotreturn "full"end ifput makeNode( parentSide, parentNode, parentLevel ) into theNodeput key into line 1 of card field id theNodeif parentNode = 0 then put theNode into rootNodetermPlotreturn "inserted"end insertNodeon moveSubTree parentSide, parentNode, parentLevel, nextNodeif nextNode ≠ 0 thenput the loc of card field id nextNode into oldLocput getNodeLoc( parentSide, parentNode, parentLevel ) into newLocset the loc of card field id nextNode to newLocget line 2 of card field id nextNodeif it ≠ 0 thendrag from oldLoc to the loc of card field id it with optionKeymoveSubTree 2, nextNode, parentLevel - 1, itend ifget line 3 of card field id nextNodeif it ≠ 0 thendrag from oldLoc to the loc of card field id it with optionKeymoveSubTree 3, nextNode, parentLevel - 1, itend ifif parentNode ≠ 0 thendrag from the loc of card field id parentNode to newLocend ifend ifend moveSubTreefunction removeNode parentSide, parentNode, parentLevel, targetNodeglobal rootNodeput line 1 of card field id targetNode into keyif line 2 of card field id targetNode = 0 thenput line 3 of card field id targetNode into nextNodeelseput line 2 of card field id targetNode into nextNodeend ifchoose line toolif parentNode ≠ 0 thendrag from the loc of card field id parentNode to¬the loc of card field id targetNode with optionKeyset the lineSize to 1end ifif nextNode ≠ 0 thendrag from the loc of card field id targetNode to¬the loc of card field id nextNode with optionKeyend ifchoose field toolclick at the loc of card field id targetNodedoMenu "Clear Field"if parentNode ≠ 0 thenput nextNode into line parentSide of card field id parentNodeend ifif targetNode = rootNode then put nextNode into rootNodechoose line toolmoveSubTree parentSide, parentNode, parentLevel, nextNodereturn keyend removeNodeon findNextglobal parentSide, parentNode, parentLevel, targetNodeput "Looking for the successor to